<template>
  <div>
    <swiper class="my-swiper-container" ref="mySwiper" :options="swiperOptions">
      <swiper-slide>
        <!--<p class="ani" swiper-animate-effect="fadeInUp" swiper-animate-duration="0.5s" swiper-animate-delay="0.3s">内容</p>-->
      </swiper-slide>
      <swiper-slide>Slide 2</swiper-slide>
      <swiper-slide>Slide 3</swiper-slide>
      <swiper-slide>Slide 4</swiper-slide>
      <swiper-slide>Slide 5</swiper-slide>
      <div class="swiper-pagination" slot="pagination"></div>
    </swiper>
  </div>
</template>

<script>

  export default {
    name: "Cool",
    components: {
    },
    data() {
      return {
        swiperOptions: {
          pagination: {
            el: '.swiper-pagination'
          },
          observer: true,//修改swiper自己或子元素时，自动初始化swiper
          observeParents: true, //修改swiper的父元素时，自动初始化swiper
        }
      }
    },
    computed: {
      swiper() {
        return this.$refs.mySwiper.$swiper
      }
    },
    mounted() {
      // console.log('Current Swiper instance object', this.swiper)
      // this.swiper.slideTo(3, 1000, false)
    }
  }
</script>

<style lang="less" scoped>
  .my-swiper-container {
    width: 100vw;
    height: 100vh;
    background-color: yellow;
    & :nth-child(2n) {
      background-color: skyblue;
    }
    & :nth-child(2n+1) {
      background-color: springgreen;
    }
  }
</style>